import formDesigner from '@/components/form-designer/index.vue'
import formRender from '@/components/form-render/index.vue'
import draggable from 'vuedraggable'
import ContainerWidgets from '@/components/form-designer/form-widget/container-widget/index'
import ContainerRender from '@/components/form-render/container/index'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const install = (app) => {
  app.use(ContainerWidgets)
  app.use(ContainerRender)
  // 注册所有图标
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    if (!app.component(key)) {
      app.component(key, component)
    }
  }
  app.component('draggable', draggable)
  app.component('formDesigner', formDesigner)
  app.component('formRender', formRender)
}
formDesigner.install = (app) => {
  app.use(ContainerWidgets)
  app.use(ContainerRender)
  // 注册所有图标
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    if (!app.component(key)) {
      app.component(key, component)
    }
  }
  app.component('draggable', draggable)
  app.component('formDesigner', formDesigner)
}
formRender.install = (app) => {
  app.use(ContainerRender)
  app.component('formRender', formRender)
}
export default { formDesigner, formRender, install }
